[pull] master from glideapps:master#71
Merged
Merged
Conversation
Add a `--prefer-unknown` CLI flag that emits `unknown` instead of `any` in TypeScript output, and `mixed` instead of `any` in Flow output. This is a fresh implementation of the feature proposed in PR #2194 by @RichiCoder1, adapted to the current codebase structure where TypeScriptFlow was split into multiple files. Closes #1619
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fixes on top of PR #2694: - Gate the System.Text.Json [JsonRequired] attribute behind the existing check-required option instead of emitting it unconditionally. It now matches the spirit of Newtonsoft's [JsonProperty(Required = ...)]: only emitted for non-optional properties when check-required is on. - Un-skip required.schema, strict-optional.schema and intersection.schema for the System.Text.Json fixture: with [JsonRequired] the renderer now implements check-required, so the expected-failure samples fail as expected. - Emit "#nullable enable" (plus the same CS8618/CS8601/CS8603 pragma suppressions the System.Text.Json renderer already uses) in the Newtonsoft renderer when csharp-version >= 8, so the new "?" reference type annotations compile without warnings. Versions 5 and 6 are unchanged. - Bump the C# test fixtures to net8.0 (and CI to the .NET 8 SDK): [JsonRequired] requires System.Text.Json 7+. - Add { "csharp-version": "8" } quick-test combinations for both the Newtonsoft and System.Text.Json fixtures. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Rename the new python-version level to 3.10: PEP 604 unions (X | None)
require Python 3.10, not 3.9. Split the feature flag into
builtinGenerics (PEP 585, 3.9+) and unionOperators (PEP 604, 3.10+),
which also yields a 3.9 level with builtin generics but typing
Optional/Union. Make 3.10 the default python-version.
- Emit " = None" defaults outside the quoted annotation: the annotation
'Foo | None = None' is invalid syntax.
- Only quote PEP 604 unions when a member actually needs a forward
reference, and never quote inside an already-quoted annotation.
- Restore withTyping("Dict") registration in the dict converter so the
typing import is emitted for pre-3.9 versions, and revert typeObject's
map branch to the runtime type "dict".
- Cover the legacy typing.* code paths in QUICKTEST via
quickTestRendererOptions for 3.5/3.6/3.7/3.9.
- Run python fixtures under Python 3.12 in CI and the fixture driver.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Resolves the ESM/spread-syntax conflicts in the TypeScriptFlow language files and reworks the option so that only the public API surface (type declarations and converter signatures) switches to unknown/mixed, while the deliberately dynamic runtime-typecheck helpers stay on `any` -- with the PR's original substitution the generated code no longer compiled when runtime typechecks were enabled. With `raw-type any` and no runtime typecheck the deserializer now narrows its unknown/mixed parameter with an explicit cast. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The next release is a major, so the breaking output change is sanctioned: generated type declarations and converter signatures now use unknown (TypeScript) / mixed (Flow) instead of any by default, which also makes the standard typescript/flow fixtures exercise the new output across the whole corpus. Opt out with --no-prefer-unknown (CLI) or "prefer-unknown": false; the quick-test entries pin the legacy any output for both fixtures. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The generated Newtonsoft JsonConverter overrides declare their parameters as non-nullable "object" while Newtonsoft.Json 13 annotates them as "object?", which produces CS8765 warnings under "#nullable enable". "dotnet run" prints warnings to stdout, which would break the fixture round-trips. Verified with the .NET 8 SDK: with this suppression every priority/samples JSON input compiles with zero warnings at csharp-version 8 for both the Newtonsoft and System.Text.Json renderers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
With dataclasses (3.7+), optional properties become nullable unions and get a " = None" default — except when the property type is Any (null is absorbed into it) or plain null (the union collapses), which got no default yet could sort after defaulted fields, making the generated dataclass raise "TypeError: non-default argument follows default argument" at import. This was latent on master because CI only ever exercised 3.5/3.6, which don't use dataclasses; with 3.10 as the new default it breaks e.g. vega-lite.schema and the combinations samples. Emit " = None" for root-level Any/None fields too, and make the property sort order compute exactly "will this field render with a default" via followTargetType — the old kind-based predicate saw pre-transformation types (transformed unions have kind "any" at sort time) and could order a non-defaulted field after defaulted ones. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Resolve conflicts keeping the PR's semantics on master's lint formatting (.js import extensions, template literals). Take master's test/fixtures.ts verbatim (the PR's only change there was a no-op reorder) and revert the PR's whitespace-only edit to .github/workflows/test-pr.yaml. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Enum cases are now styled Scala identifiers (via a proper enum-case namer) with explicit Decoder/Encoder mappings back to the original JSON strings, so keywords, "_", "", and other arbitrary values all work. This subsumes the special-cased blank-enum emission, which produced Decoder[""] -- a literal singleton type that plain circe has no decoder for -- alongside a commented-out generic given. Union decoders are tried most-discriminating-first (enums, then strings, then the remaining primitives, classes last) via a shared sort order in utils, because circe's numeric decoders also accept strings like "5". Scala.Right/scala.Left are fully qualified in the enum codecs so that generated types named Right/Left don't shadow them, property names containing spaces are backtick-quoted (one shared backtickedName helper replaces the copy-pasted quoting logic), and top-level primitives emit a type alias so they compile at all. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The upickle rewrite from PR #2246 (OptionPickler for absent/null options, badMerge for untagged unions) had several bugs that were never caught because the fixture was unregistered: - Union readers were tried in name order, so a case class whose fields are all defaulted would spuriously read strings and arrays as the all-defaults instance. Readers now run most-discriminating-first (shared sort order with the circe renderer). - upickle's built-in primitive readers are lenient in both directions (numbers read as strings, strings read as numbers/booleans), so unions now use strict per-type readers emitted in JsonExt. - The union writer used OptionPickler.write (a String) inside comap[ujson.Value], double-encoding every union value; it now uses writeJs. - Unions containing null referenced a NullValue type that was never emitted; the header now defines it with a strict ReadWriter. - Enums relied on raw JSON strings as case names; they are now styled identifiers with an explicit bimap ReadWriter mapping them back to the original strings. - The unused upickleEncoderForType, the unused widen extension, the commented-out singleton pickler, and the mislabeled unionReader/unionWriter given names are cleaned up. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PR #2246 added test/fixtures/scala3-upickle/ but never registered it: there was no Language entry, no fixture registration, and no CI matrix entry, so the upickle renderer had zero test exposure. This adds Scala3UpickleLanguage (framework: upickle), registers scala3-upickle / schema-scala3-upickle fixtures, and puts them in the CI matrix (the existing scala3 toolchain-setup conditions match the new names). Driver fixes: - circe.scala now exits nonzero on parse/decode failure (it used to print the DecodingFailure and exit 0, making every expected-failure schema sample undetectable), uses scala.Right/scala.Left patterns so generated types named Right/Left can't shadow them, and drops dead commented-out code. - upickle.scala drops the unused os-lib dependency and dead code. Skip lists are rebuilt from an exhaustive local generate+compile+ round-trip sweep of priority/samples/misc JSON and the schema corpus with scala-cli (Scala 3.2.2, circe 0.14.5, upickle 3.1.0): - Both frameworks now run everything except six inputs that hit the raw-identifier limitation (empty property names, bare "_", backticks/emoji in names, generated classes shadowing None/Option) plus keyword-unions.schema for the same reason. - Un-skipped for circe: github-events, kitchen-sink, no-classes, name-style, combinations1-4, unions, php-mixed-union, the whole "sorted differently" group, and 13 schemas including keyword-enum.schema, enum.schema, required.schema, intersection and the untagged-union group (the driver exit-code fix makes their fail samples detectable, and the renderer fixes make them pass). - Four misc inputs move from skipJSON to skipDiffViaSchema: they round-trip fine and only hit a pre-existing property-ordering quirk in the JSON-Schema-derived generation path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Bumps [@types/unicode-properties](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/unicode-properties) from 1.3.0 to 1.3.2. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/unicode-properties) --- updated-dependencies: - dependency-name: "@types/unicode-properties" dependency-version: 1.3.2 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [@types/urijs](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/urijs) from 1.19.25 to 1.19.26. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/urijs) --- updated-dependencies: - dependency-name: "@types/urijs" dependency-version: 1.19.26 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
Support for Python3.9 type hint syntax
C#: Adds version 8 and expands nullability to reference types (#1632)
feat: add --prefer-unknown option for TypeScript and Flow
Improved-scala3-enums
…/unicode-properties-1.3.2 build(deps-dev): bump @types/unicode-properties from 1.3.0 to 1.3.2
…/urijs-1.19.26 build(deps): bump @types/urijs from 1.19.25 to 1.19.26
Bumps [ajv](https://github.com/ajv-validator/ajv) from 5.5.2 to 8.20.0. - [Release notes](https://github.com/ajv-validator/ajv/releases) - [Commits](ajv-validator/ajv@v5.5.2...v8.20.0) --- updated-dependencies: - dependency-name: ajv dependency-version: 8.20.0 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Ajv 8 removed the `format` and `unknownFormats` constructor options and no longer bundles the draft-06 meta-schema that our generated schemas declare. Update the JSONSchemaJSONFixture validation accordingly: - register the draft-06 meta-schema shipped in ajv/dist/refs - install format validators from the new ajv-formats package (its default "full" mode matches the old `format: "full"` option); our custom date-time format is registered afterwards so it still wins - declare the quicktype-specific schema keywords qt-uri-protocols and qt-uri-extensions as a vocabulary so strict mode accepts them - register the "integer" and "boolean" pseudo-formats as always-valid (`true`), replacing `unknownFormats: ["integer", "boolean"]` Verified with QUICKTEST=true FIXTURE=schema-json-csharp script/test (45/45 passing) and the unit test suite. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
….20.0 build(deps-dev): bump ajv from 5.5.2 to 8.20.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )